#include <iostream>
#include "rdtsc.h"

inline uint64_t Rdtsc::rdtsc()
{
  uint32_t lo, hi;
  asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));

  return (uint64_t)hi << 32 | lo;
}

void Rdtsc::start()
{
  begin = rdtsc();
}

void Rdtsc::stop()
{
  end = rdtsc();
  std::cout << "CPU Ticks: " << end - begin << "\n";
}
